package programmierung.aufgabe4;

public class FibonacciRekursiv {

	public int fibonacci(int i) {

		if (i < 0) {
			throw new IllegalArgumentException();
		} else if (i > 0) {

			return fibRec(1, 1, i - 2);
		}

		return 0;
	}

	private int fibRec(int sOld, int old, int i) {
		if (i > 0) {
			return fibRec(sOld + old, sOld, i - 1);
		} else {
			return sOld;
		}
	}

}
